"""
    Title

    author: wxz
    date: 
    github: https://github.com/xinzwang
"""
import glob
import os
from pathlib import Path
import xml.etree.ElementTree as ET


def voc_label_clean():
    path = 'G:/datasets/LOD'
    raw_label_path = path + '/RAW-normal-Annotations(raw_version)'
    # rgb_label_path = path + '/RGB-normal-Annotations'

    raw_label_path = Path(raw_label_path)
    # rgb_label_path = Path(rgb_label_path)

    raw_labels = glob.glob(str(raw_label_path / '**' / '*.*'), recursive=True)
    raw_labels = sorted(x.replace('/', os.sep) for x in raw_labels if x.split('.')[-1].lower() in ['xml'])

    # rgb_labels = glob.glob(str(raw_label_path / '**' / '*.*'), recursive=True)
    # rgb_labels = sorted(x.replace('/', os.sep) for x in rgb_labels if x.split('.')[-1].lower() in ['.xml'])

    for p in raw_labels:
        tree = ET.parse(p)
        root = tree.getroot()
        img_path = root.find('path')



if __name__ == "__main__":
    voc_label_clean()
